package com.atguigu.gulimall.member.web;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.atguigu.common.utils.PageUtils;
import com.atguigu.common.utils.R;
import com.atguigu.gulimall.member.feign.OrderFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;

/**
 * @author 满超
 * @date 2020/07/01
 **/
@Controller
public class IndexMemberController {

    @Autowired
    OrderFeign orderFeign;

    /**
     * 支付成功跳转页
     * @return
     */
    @GetMapping("/memberOrder.html")
    public String memberOrder(@RequestParam(value = "pageNum",defaultValue = "1") Integer pageNum, Model model, HttpServletRequest request){

        Map<String, Object> map = new HashMap<>();
        map.put("page", pageNum);
        R r = orderFeign.listWithItem(map);//查询此订单所有商品信息信息

        System.out.println(JSON.toJSONString(r));
        model.addAttribute("orders", r);

        return "orderList";
    }
}
